package ceha.application;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.beans.Beans;
import java.io.IOException;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;

public class CEHAFicheConsultation extends javax.swing.JFrame {

    private boolean flagclicOne;
    private CEHAMain main;
    private CEHAData cehadata;

    public CEHAFicheConsultation(CEHAMain main) {
        this.main = main;

        initComponents();
        if (!Beans.isDesignTime()) {
            entityManager.getTransaction().begin();
        }
        int inset = 50;
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2);

    }

//    public JLabel getVignette1() {
//        return vignette1;
//    }
//
//    public JInternalFrame getFicheAcreerJIF() {
//        return ficheAcreerJIF;
//    }

    public JInternalFrame getFichespourconsultJIF() {
        return fichespourconsultJIF;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("BDDCEHAPU").createEntityManager();
        query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT f FROM Fiche f");
        list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList());
        desktop = new javax.swing.JDesktopPane();
        fichespourconsultJIF = new javax.swing.JInternalFrame();
        motscles = new javax.swing.JPanel();
        suivant = new javax.swing.JButton();
        mot1 = new javax.swing.JTextField();
        mot2 = new javax.swing.JTextField();
        mot3 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        effacer = new javax.swing.JButton();
        descritionpanel = new javax.swing.JPanel();
        imagefilenameLabel = new javax.swing.JLabel();
        sourceLabel = new javax.swing.JLabel();
        titreLabel = new javax.swing.JLabel();
        auteurLabel = new javax.swing.JLabel();
        dateLabel = new javax.swing.JLabel();
        resumeLabel = new javax.swing.JLabel();
        lienimageLabel = new javax.swing.JLabel();
        lienvignette = new javax.swing.JTextField();
        auteurField = new javax.swing.JTextField();
        lienimageField = new javax.swing.JTextField();
        sourcecombo = new javax.swing.JComboBox();
        typedocumentLabel1 = new javax.swing.JLabel();
        typedocCombo = new javax.swing.JComboBox();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        datetexteLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        resumeArea = new javax.swing.JTextArea();
        historicpanel = new javax.swing.JPanel();
        dimensionLabel = new javax.swing.JLabel();
        localisationLabel = new javax.swing.JLabel();
        droitsreproLabel = new javax.swing.JLabel();
        datedonationLabel = new javax.swing.JLabel();
        fondLabel = new javax.swing.JLabel();
        fondField = new javax.swing.JTextField();
        localisationField = new javax.swing.JTextField();
        dimensionField = new javax.swing.JTextField();
        jDateChooser2 = new com.toedter.calendar.JDateChooser();
        droitsreproCombo = new javax.swing.JComboBox();
        lienfichierLabel = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        siecleCombo = new javax.swing.JComboBox();
        CadreVignette = new javax.swing.JPanel();
        vignette = new javax.swing.JLabel();
        lienfichierButton = new javax.swing.JButton();
        menubar1 = new javax.swing.JMenuBar();
        mainmenu = new javax.swing.JMenu();
        quitte = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        desktop.setForeground(new java.awt.Color(255, 255, 255));
        desktop.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        fichespourconsultJIF.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        fichespourconsultJIF.setIconifiable(true);
        fichespourconsultJIF.setOpaque(true);
        fichespourconsultJIF.setVerifyInputWhenFocusTarget(false);
        fichespourconsultJIF.setVisible(true);

        motscles.setBackground(new java.awt.Color(153, 153, 153));

        suivant.setFont(new java.awt.Font("Verdana", 1, 14));
        suivant.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/entrez.gif"))); // NOI18N
        suivant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                suivantActionPerformed(evt);
            }
        });

        mot1.setFont(new java.awt.Font("Tahoma", 0, 14));

        mot2.setFont(new java.awt.Font("Tahoma", 0, 14));

        mot3.setFont(new java.awt.Font("Tahoma", 0, 14));

        jLabel1.setBackground(new java.awt.Color(204, 204, 204));
        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Recherche par mots-clés");

        effacer.setFont(new java.awt.Font("Times New Roman", 1, 12));
        effacer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/gomme.gif"))); // NOI18N
        effacer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                effacerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout motsclesLayout = new javax.swing.GroupLayout(motscles);
        motscles.setLayout(motsclesLayout);
        motsclesLayout.setHorizontalGroup(
            motsclesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(motsclesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(motsclesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(motsclesLayout.createSequentialGroup()
                        .addComponent(suivant, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(effacer))
                    .addGroup(motsclesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(mot3, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(mot2, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(mot1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(11, Short.MAX_VALUE))
        );
        motsclesLayout.setVerticalGroup(
            motsclesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, motsclesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(mot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(16, 16, 16)
                .addComponent(mot2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19)
                .addComponent(mot3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(14, 14, 14)
                .addGroup(motsclesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(suivant, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(effacer, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        descritionpanel.setBackground(new java.awt.Color(204, 204, 204));

        imagefilenameLabel.setBackground(new java.awt.Color(153, 153, 153));
        imagefilenameLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        imagefilenameLabel.setForeground(new java.awt.Color(51, 51, 51));
        imagefilenameLabel.setText("Vignette");

        sourceLabel.setBackground(new java.awt.Color(153, 153, 153));
        sourceLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        sourceLabel.setForeground(new java.awt.Color(51, 51, 51));
        sourceLabel.setText("Source");

        titreLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        titreLabel.setForeground(new java.awt.Color(51, 51, 51));
        titreLabel.setText("Titre*");

        auteurLabel.setBackground(new java.awt.Color(153, 153, 153));
        auteurLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        auteurLabel.setForeground(new java.awt.Color(51, 51, 51));
        auteurLabel.setText("Auteur");

        dateLabel.setBackground(new java.awt.Color(153, 153, 153));
        dateLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        dateLabel.setForeground(new java.awt.Color(51, 51, 51));
        dateLabel.setText("Date ");

        resumeLabel.setBackground(new java.awt.Color(153, 153, 153));
        resumeLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        resumeLabel.setForeground(new java.awt.Color(51, 51, 51));
        resumeLabel.setText("Resumé");

        lienimageLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienimageLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        lienimageLabel.setForeground(new java.awt.Color(51, 51, 51));
        lienimageLabel.setText("Lien vers une image");

        lienvignette.setEnabled(false);

        auteurField.setFont(new java.awt.Font("Times New Roman", 1, 24));
        auteurField.setEnabled(false);

        lienimageField.setFont(new java.awt.Font("Tahoma", 1, 12));

        sourcecombo.setFont(new java.awt.Font("Verdana", 1, 12));
        sourcecombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Original", "Copie" }));
        sourcecombo.setEnabled(false);

        typedocumentLabel1.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        typedocumentLabel1.setText("Type de document");

        typedocCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        typedocCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Affiche", "Album thématique", "Carte postale", "Imprimé", "Journal", "Livre", "Magazine / Revue", "Manuscrit papier", "Manuscrit Vélin", "Matériel archéologique", "Numismatique", "Objet", "Photographie", "Plan", "Tableau / Gravure", "Tapuscrit", "Témoignage audio", "Témoignage vidéo", "Autres" }));
        typedocCombo.setEnabled(false);

        jDateChooser1.setDateFormatString("DD MM YYYY");
        jDateChooser1.setFont(new java.awt.Font("Verdana", 1, 12));

        datetexteLabel1.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        datetexteLabel1.setText("Date (autres)");

        resumeArea.setColumns(20);
        resumeArea.setFont(new java.awt.Font("Times New Roman", 1, 12));
        resumeArea.setLineWrap(true);
        resumeArea.setRows(5);
        resumeArea.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        resumeArea.setDragEnabled(true);
        resumeArea.setEnabled(false);
        jScrollPane1.setViewportView(resumeArea);

        historicpanel.setBackground(new java.awt.Color(153, 153, 153));
        historicpanel.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 204, 0), 2, true), "historique du document", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 3, 14), new java.awt.Color(255, 204, 0))); // NOI18N

        dimensionLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        dimensionLabel.setText("Dimension");

        localisationLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        localisationLabel.setText("Localisation");

        droitsreproLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        droitsreproLabel.setText("Droits de reproduction");

        datedonationLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        datedonationLabel.setText("Date de donation");

        fondLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        fondLabel.setText("Fond");

        fondField.setFont(new java.awt.Font("Tahoma", 0, 12));

        localisationField.setFont(new java.awt.Font("Tahoma", 0, 12));

        dimensionField.setFont(new java.awt.Font("Tahoma", 0, 12));

        jDateChooser2.setDateFormatString("DD MM YYYY");
        jDateChooser2.setEnabled(false);

        droitsreproCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        droitsreproCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Fonds propres CEHA (droits réservés)", "Item 2", "Item 3", "Item 4" }));
        droitsreproCombo.setEnabled(false);

        javax.swing.GroupLayout historicpanelLayout = new javax.swing.GroupLayout(historicpanel);
        historicpanel.setLayout(historicpanelLayout);
        historicpanelLayout.setHorizontalGroup(
            historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicpanelLayout.createSequentialGroup()
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(historicpanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(fondLabel)
                        .addGap(18, 18, 18)
                        .addComponent(fondField, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(datedonationLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(historicpanelLayout.createSequentialGroup()
                        .addComponent(droitsreproLabel)
                        .addGap(18, 18, 18)
                        .addComponent(droitsreproCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(historicpanelLayout.createSequentialGroup()
                        .addComponent(localisationLabel)
                        .addGap(18, 18, 18)
                        .addComponent(localisationField, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)
                        .addComponent(dimensionLabel)
                        .addGap(27, 27, 27)
                        .addComponent(dimensionField)))
                .addContainerGap(51, Short.MAX_VALUE))
        );
        historicpanelLayout.setVerticalGroup(
            historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(fondLabel)
                        .addComponent(fondField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(datedonationLabel))
                    .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(droitsreproLabel)
                    .addComponent(droitsreproCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(historicpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(localisationLabel)
                    .addComponent(localisationField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dimensionLabel)
                    .addComponent(dimensionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lienfichierLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienfichierLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        lienfichierLabel.setText("Lien vers un fichier (PDF)");

        jTextArea1.setColumns(20);
        jTextArea1.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jScrollPane2.setViewportView(jTextArea1);

        siecleCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        siecleCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXème", "XIXème", "XVIIIème", "XVIIème" }));
        siecleCombo.setEnabled(false);

        CadreVignette.setBackground(new java.awt.Color(204, 204, 204));
        CadreVignette.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));

        vignette.setBackground(new java.awt.Color(255, 255, 255));
        vignette.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/fondlogoCEHA.jpg"))); // NOI18N
        vignette.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BELOW_TOP, new java.awt.Font("Verdana", 3, 12), new java.awt.Color(0, 0, 0))); // NOI18N

        javax.swing.GroupLayout CadreVignetteLayout = new javax.swing.GroupLayout(CadreVignette);
        CadreVignette.setLayout(CadreVignetteLayout);
        CadreVignetteLayout.setHorizontalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CadreVignetteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(vignette, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        CadreVignetteLayout.setVerticalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CadreVignetteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(vignette, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lienfichierButton.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lienfichierButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lienfichierButtonlienPDFButton(evt);
            }
        });

        javax.swing.GroupLayout descritionpanelLayout = new javax.swing.GroupLayout(descritionpanel);
        descritionpanel.setLayout(descritionpanelLayout);
        descritionpanelLayout.setHorizontalGroup(
            descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(descritionpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(descritionpanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 573, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(descritionpanelLayout.createSequentialGroup()
                            .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(titreLabel)
                                .addGroup(descritionpanelLayout.createSequentialGroup()
                                    .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(auteurLabel)
                                        .addComponent(dateLabel))
                                    .addGap(18, 18, 18)
                                    .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, descritionpanelLayout.createSequentialGroup()
                                            .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(datetexteLabel1)
                                            .addGap(18, 18, 18)
                                            .addComponent(siecleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE)
                                        .addComponent(auteurField, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE)))
                                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, descritionpanelLayout.createSequentialGroup()
                                        .addComponent(imagefilenameLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(lienvignette))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, descritionpanelLayout.createSequentialGroup()
                                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(typedocumentLabel1)
                                            .addComponent(sourceLabel))
                                        .addGap(18, 18, 18)
                                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(sourcecombo, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(typedocCombo, javax.swing.GroupLayout.Alignment.LEADING, 0, 207, Short.MAX_VALUE))))
                                .addComponent(resumeLabel))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(21, 21, 21))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, descritionpanelLayout.createSequentialGroup()
                            .addComponent(historicpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGap(21, 21, 21))
                        .addGroup(descritionpanelLayout.createSequentialGroup()
                            .addComponent(lienfichierButton, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(lienfichierLabel)
                            .addGap(21, 21, 21))
                        .addGroup(descritionpanelLayout.createSequentialGroup()
                            .addComponent(lienimageField, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(lienimageLabel)
                            .addGap(77, 77, 77)))))
        );
        descritionpanelLayout.setVerticalGroup(
            descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(descritionpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(descritionpanelLayout.createSequentialGroup()
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(imagefilenameLabel)
                            .addComponent(lienvignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(sourceLabel)
                            .addComponent(sourcecombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(typedocumentLabel1)
                            .addComponent(typedocCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(titreLabel)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(auteurLabel)
                            .addComponent(auteurField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(dateLabel)
                            .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(datetexteLabel1)
                                    .addComponent(siecleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(22, 22, 22)
                        .addComponent(resumeLabel))
                    .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lienfichierButton, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lienfichierLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(descritionpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lienimageField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lienimageLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(historicpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout fichespourconsultJIFLayout = new javax.swing.GroupLayout(fichespourconsultJIF.getContentPane());
        fichespourconsultJIF.getContentPane().setLayout(fichespourconsultJIFLayout);
        fichespourconsultJIFLayout.setHorizontalGroup(
            fichespourconsultJIFLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fichespourconsultJIFLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(descritionpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(motscles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        fichespourconsultJIFLayout.setVerticalGroup(
            fichespourconsultJIFLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fichespourconsultJIFLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(fichespourconsultJIFLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(motscles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(descritionpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(15, 15, 15))
        );

        fichespourconsultJIF.setBounds(0, 0, 860, 610);
        desktop.add(fichespourconsultJIF, javax.swing.JLayeredPane.DEFAULT_LAYER);

        menubar1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        menubar1.setFont(new java.awt.Font("Times New Roman", 1, 14));

        mainmenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/petitlogoCEHA.jpg"))); // NOI18N
        mainmenu.setText("CEHA");

        quitte.setText("Quitter");
        quitte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitteActionPerformed(evt);
            }
        });
        mainmenu.add(quitte);

        menubar1.add(mainmenu);

        setJMenuBar(menubar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 1021, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 934, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(84, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void quitteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitteActionPerformed
        System.exit(0);
    }//GEN-LAST:event_quitteActionPerformed

    private void suivantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suivantActionPerformed
        //        java.sql.Connection conn = new Mysql().Connect();
        //        Statement stmt;
        //        String req = "SELECT * FROM fiche WHERE titre = '" + mot1.getText() + "'";
        //        try {
        //            stmt = conn.createStatement();
        //            ResultSet resultat = stmt.executeQuery(req);
        //            resultat.next();
        //            System.out.println(resultat.getArray(0));
        //            while (resultat.next()) {
        //                System.out.println(resultat.getArray(0));
        //            }
        //
        //        } catch (SQLException ex) {
        //            ex.printStackTrace();
        //        }
}//GEN-LAST:event_suivantActionPerformed

    private void effacerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_effacerActionPerformed
        mot1.setText("");
        mot2.setText("");
        mot3.setText("");
}//GEN-LAST:event_effacerActionPerformed

    private void lienfichierButtonlienPDFButton(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lienfichierButtonlienPDFButton

        //test lecture pdf
        Process p = null;
        try {
            p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + lienfichierButton.getText());
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        try {
            p.waitFor();
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
}//GEN-LAST:event_lienfichierButtonlienPDFButton
//    private void ficheEnable(boolean b) {
//
//        lienvignette.setEnabled(b);
//
//        sourcecombo.setEnabled(b);
//        typedocCombo.setEnabled(b);
//
//        auteurField.setEnabled(b);
//        jDateChooser1.setEnabled(b);
//        siecleCombo.setEnabled(b);
//        resumeArea.setEnabled(b);
//        lienimageField.setEnabled(b);
//
//        fondField.setEnabled(b);
//        jDateChooser2.setEnabled(b);
//        droitsreproCombo.setEnabled(b);
//        localisationField.setEnabled(b);
//        dimensionField.setEnabled(b);
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel CadreVignette;
    private javax.swing.JTextField auteurField;
    private javax.swing.JLabel auteurLabel;
    private javax.swing.JLabel dateLabel;
    private javax.swing.JLabel datedonationLabel;
    private javax.swing.JLabel datetexteLabel1;
    private javax.swing.JPanel descritionpanel;
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JTextField dimensionField;
    private javax.swing.JLabel dimensionLabel;
    private javax.swing.JComboBox droitsreproCombo;
    private javax.swing.JLabel droitsreproLabel;
    private javax.swing.JButton effacer;
    private javax.persistence.EntityManager entityManager;
    private javax.swing.JInternalFrame fichespourconsultJIF;
    private javax.swing.JTextField fondField;
    private javax.swing.JLabel fondLabel;
    private javax.swing.JPanel historicpanel;
    private javax.swing.JLabel imagefilenameLabel;
    private com.toedter.calendar.JDateChooser jDateChooser1;
    private com.toedter.calendar.JDateChooser jDateChooser2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JButton lienfichierButton;
    private javax.swing.JLabel lienfichierLabel;
    private javax.swing.JTextField lienimageField;
    private javax.swing.JLabel lienimageLabel;
    private javax.swing.JTextField lienvignette;
    private java.util.List<ceha.Fiche> list;
    private javax.swing.JTextField localisationField;
    private javax.swing.JLabel localisationLabel;
    private javax.swing.JMenu mainmenu;
    private javax.swing.JMenuBar menubar1;
    private javax.swing.JTextField mot1;
    private javax.swing.JTextField mot2;
    private javax.swing.JTextField mot3;
    private javax.swing.JPanel motscles;
    private javax.persistence.Query query;
    private javax.swing.JMenuItem quitte;
    private javax.swing.JTextArea resumeArea;
    private javax.swing.JLabel resumeLabel;
    private javax.swing.JComboBox siecleCombo;
    private javax.swing.JLabel sourceLabel;
    private javax.swing.JComboBox sourcecombo;
    private javax.swing.JButton suivant;
    private javax.swing.JLabel titreLabel;
    private javax.swing.JComboBox typedocCombo;
    private javax.swing.JLabel typedocumentLabel1;
    private javax.swing.JLabel vignette;
    // End of variables declaration//GEN-END:variables
}
